<?php
/**
 * Created by PhpStorm.
 * User: yangfan
 * Date: 2019/11/28
 * Time: 5:10 PM
 */

namespace App\BO\Order\OrderRollback;

use App\BO\PipelineConfig;
use App\Entities\OrderEntity;
use App\Utils\PipelineProxy;

class OrderRollbackProxy
{
    private static $handle = 'handle';

    private static $pipe = [
        CouponOrderRollback::class, // 回退优惠券
        BalanceOrderRollback::class,  // 回退余额
    ];

    public static function rollback(OrderEntity $orderEntity)
    {
        $pipelineConfig = new PipelineConfig();
        $pipelineConfig->setPipes(self::$pipe);
        $pipelineConfig->setHandle(self::$handle);

        return PipelineProxy::execute($orderEntity, $pipelineConfig);
    }
}
